import {Entity, PrimaryGeneratedColumn, Column, ManyToOne, BaseEntity} from 'typeorm';
import { User } from './user.entity';
import { GoodsSPU } from './goods-spu.entity';
import { GoodsSKU } from './goods-sku.entity';

@Entity()
export class ShoppingCart extends BaseEntity {
    @PrimaryGeneratedColumn()
    id: number;

    @ManyToOne(() => User)
    user: User;

    @ManyToOne(() => GoodsSPU)
    goodsSPU: GoodsSPU;

    @ManyToOne(() => GoodsSKU)
    goodsSKU: GoodsSKU;

    @Column()
    quantity: number;

    @Column()
    goodsName: string;

    @Column()
    goodsCover: string;

    @Column()
    goodsAttrs: string;

    @Column()
    selected: boolean;
}
